<?php 
$opensslConfigPath = "D:/phpstudy_pro/Extensions/Apache2.4.39/conf/openssl.cnf";	
$config = array(
    "digest_alg" => "sha512",
    "private_key_bits" =>1024,
    "private_key_type" => OPENSSL_KEYTYPE_RSA,
	'config'=> $opensslConfigPath
);
 
 
//创建密钥对
$res = openssl_pkey_new($config);
//生成私钥
openssl_pkey_export($res, $privkey, null, $config);
//生成公钥
$pubKey = openssl_pkey_get_details($res)['key'];
print_r($privkey);
echo '<div style="height:100px;background:#ff0000">1</div>';
print_r($pubKey);
file_put_contents('private.key',$privkey);
file_put_contents('public.key',$pubKey);
